

package org.example.price.controller;

import org.example.feign.feignClient.PojoServiceClient;
import org.example.feign.pojo.Pay;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Map;
//
//
//
//import org.example.feign.pojo.Pay;
//import org.example.userservice.service.PojoService;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RestController;
//

//import java.util.Map;
//
//
@CrossOrigin("*")
@RestController
public class PayController {

    Pay pay = new Pay();

    private final PojoServiceClient pojoServiceClient;

    public  PayController( PojoServiceClient pojoServiceClient) {
        this.pojoServiceClient = pojoServiceClient;

    }
    @PostMapping("/Pay")
    public String User(@RequestBody Map<Object, Object> request) throws IOException {
        // 从请求体中获取用户数据

        pay.setTony((String) request.get("Tony"));
        pay.setTime((String) request.get("Time"));
        pay.setStatu((String) request.get("Statu"));
        pay.setPrice((String) request.get("Price"));
        pay.setPriceName((String) request.get("PriceName"));
        pay.setCustomerName((String) request.get(("CustomerName")));

        System.out.println(pay); //1.以字节输入流方式读取核心配置文件
        pojoServiceClient.pay(pay);
        return "保存成功";
    }
}